/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.metadataRepository.repository.xmlConfiguration;

import cz.mzk.oai.metadataRepository.transformation.XsltConfig;
import cz.mzk.oai.metadataRepository.metadata.MetadataFormat;
import java.util.Set;

/**
 *
 * @author Martin Rehanek (rehan at mzk.cz)
 */
class CollectionsCommonConfig {

    protected Set<MetadataFormat> metadataFormats;
    protected Set<XsltConfig> xsltConfigs;

    CollectionsCommonConfig(Set<MetadataFormat> formats, Set<XsltConfig> transformations) {
        this.metadataFormats = formats;
        this.xsltConfigs = transformations;
    }

    /**
     * @return the formats
     */
    public Set<MetadataFormat> getMetadataFormats() {
        return metadataFormats;
    }

    /**
     * @return the transforamtions
     */
    public Set<XsltConfig> getTransformationConfigs() {
        return xsltConfigs;
    }

    @Override
    public String toString() {
        StringBuilder result = new StringBuilder();
        char eoln = '\n';
        result.append("formats: ");
        for (MetadataFormat format : metadataFormats) {
            result.append(format.toString()).append(',');
        }
        result.append(eoln);
        result.append("transformations: ").append(eoln);
        for (XsltConfig config : xsltConfigs) {
            XsltConfig transs = (XsltConfig) config;
            result.append(transs.getFromFormat().toString());
            result.append("->");
            result.append(transs.getToFormat().toString());
            result.append(": ").append(transs.getXsltFile().getAbsolutePath());
            result.append(eoln);
        }
        return result.toString();
    }
}
